package com.vcms.cms.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * VoteItem entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "vote_item", catalog = "vcms_0.1")
public class VoteItem implements java.io.Serializable {

	// Fields

	private Integer voteItemId;
	private VoteTopic voteTopic;
	private String title;
	private Integer voteCount;
	private Integer priority;
	private Set<VoteRecord> voteRecords = new HashSet<VoteRecord>(0);

	// Constructors

	/** default constructor */
	public VoteItem() {
	}

	/** full constructor */
	public VoteItem(VoteTopic voteTopic, String title, Integer voteCount,
			Integer priority, Set<VoteRecord> voteRecords) {
		this.voteTopic = voteTopic;
		this.title = title;
		this.voteCount = voteCount;
		this.priority = priority;
		this.voteRecords = voteRecords;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "voteItemId", unique = true, nullable = false)
	public Integer getVoteItemId() {
		return this.voteItemId;
	}

	public void setVoteItemId(Integer voteItemId) {
		this.voteItemId = voteItemId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "voteTopicId")
	public VoteTopic getVoteTopic() {
		return this.voteTopic;
	}

	public void setVoteTopic(VoteTopic voteTopic) {
		this.voteTopic = voteTopic;
	}

	@Column(name = "title", length = 300)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "voteCount")
	public Integer getVoteCount() {
		return this.voteCount;
	}

	public void setVoteCount(Integer voteCount) {
		this.voteCount = voteCount;
	}

	@Column(name = "priority")
	public Integer getPriority() {
		return this.priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "voteItem")
	public Set<VoteRecord> getVoteRecords() {
		return this.voteRecords;
	}

	public void setVoteRecords(Set<VoteRecord> voteRecords) {
		this.voteRecords = voteRecords;
	}

}